package com.gem.shop.service.impl;

import com.gem.shop.dao.OrderDao;
import com.gem.shop.entity.Order;
import com.gem.shop.service.OrderService;
import com.gem.shop.util.BeanFactory;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author zhang
 * @date 2020/10/3 14:44
 */
//Spring声明式事务
@Transactional
public class OrderServiceImpl implements OrderService {

    OrderDao orderDao = (OrderDao) BeanFactory.getBean("orderDao");
    @Override
    public void addOrder(Order order) {
        orderDao.insertOrder(order);
    }

    @Override
    public List<Order> findOrderByCustomerId(int id) {
        return orderDao.selectOrderByCustomerId(id);
    }
}
